Skip to content

fix: expose __queryClient only in dev, un-double-format TVL, type-check tests, seed farm e2e via network (#471, #472, #473, #475) - #503

Merged
ritaifeoluwa merged 25 commits into
SmartDropLabs:mainfrom
SweetBoy-eth:fix/issues-471-472-473-475
Sep 25, 2026
Merged

ritaifeoluwa merged 25 commits into
SmartDropLabs:mainfrom
SweetBoy-eth:fix/issues-471-472-473-475

Conversation

@SweetBoy-eth

@SweetBoy-eth SweetBoy-eth commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Four fixes across E2E hygiene, stats rendering, and TypeScript coverage.

closes #474 — Never expose window.__queryClient in production

ContextProvider now assigns window.__queryClient only when
process.env.NODE_ENV !== 'production'. The QueryClient is no longer
leaked in production bundles (previously gated only on
NEXT_PUBLIC_E2E). Dev-server E2E (lock-unlock-lifecycle) keeps
working since pnpm dev runs with NODE_ENV=development.

closes #476 — Stop double-formatting Total Value Locked

getPlatformStats() already returns totalValueLocked as a localized
currency string ("$3,500"). PlatformStats was piping that through
formatCredits, rendering $0.0M XLM. The TVL stat now renders
stats.tvl directly; formatCredits remains in use for the credit
velocity stat (raw credit units).

  • Updated test mock (tvl: '$3,500', raw credit-velocity number)
  • Regenerated PlatformStats snapshot

closes #477 — Type-check test files

Removed **/*.test.ts(x) from tsconfig.json exclude so tests are
covered by pnpm typecheck (configs and e2e/**, tests/** stay
excluded). Fixed every error this surfaced:

  • loading.tsx: widen SkeletonBar.w to accept responsive objects
  • Navbar.tsx: add missing useEffect import
  • useLockFlow.ts: remove duplicate stepRef declaration
  • farmStore.ts: export FarmStore type for selector typing
  • Typed wallet/toast/mocks across BoostModal, UnlockModal, useLeaderboard,
    useSorobanEvents, useSorobanQuery, validateEnv tests
  • Buffer.alloc instead of new Uint8Array().fill() for StrKey seeds
    (feeBumpGuard, soroban, feebump, history tests)
  • Cast auth fixtures and process.env where strict types required it

closes #475 — Seed farm.spec.ts at the network layer

Rewrote e2e/farm.spec.ts to remove all window.__queryClient
dependency (per issue). Pool and position data are now seeded by
mocking the Soroban RPC HTTP layer:

  • simulateTransaction returns pre-computed XDR for get_pools /
    get_user_position, function-specific auth for lock/unlock
  • sendTransaction flips a stateful empty ⇄ locked position so the
    post-mutation QueryClient invalidation refetches updated data
  • getLatestLedger intentionally omits headerXdr/metadataXdr so
    velocity/events polling fails closed without hitting the real network
  • locked_at fixture uses epoch ms to match FarmPosition
    (unlockAvailableAt = lockedAt + lockPeriodSeconds * 1000)
  • e2e/playwright.config.ts sets NEXT_PUBLIC_FACTORY_CONTRACT_ID and
    NEXT_PUBLIC_SIMULATION_ACCOUNT in webServer.env so
    getFactoryPools / simulation calls resolve under the dev server

Verification

  • npx tsc --noEmit → 0 errors (was 9 pre-existing + all newly
    surfaced test-file errors)
  • 13 changed unit-test suites → 96/96 passing
  • playwright e2e/farm.spec.ts → 5/5 passing (connect, deposit,
    countdown, fast-forward unlock, unlock submit)
  • playwright --list → 15 tests / 6 files, no collection errors
  • Remaining suite failures (useLeaderboard race, useSorobanEvents
    retention) fail identically on baseline main

…uction

Never leak the QueryClient in a production bundle; dev-only check keeps
pnpm dev e2e (lock-unlock-lifecycle) working without NEXT_PUBLIC_E2E.
…double-format

getPlatformStats already returns totalValueLocked as a localized
currency string (e.g. $3,500); formatCredits turned it into $0.0M XLM.
Drop **/*.test.{ts,tsx} from tsconfig exclude so test files are
type-checked; keep vitest/playwright configs and tests/**, e2e/**.
…ver env

Set NEXT_PUBLIC_FACTORY_CONTRACT_ID and NEXT_PUBLIC_SIMULATION_ACCOUNT
so getFactoryPools succeeds under the Playwright dev server.
…ueryClient

Mock soroban-testnet RPC (get_pools/get_user_position XDR, sendTransaction
flips position state) instead of injecting into window.__queryClient;
stateful lock/unlock flows with fixed clock for countdown tests.
…ixture

FarmPosition.lockedAt is ms (unlockAvailableAt = lockedAt +
lockPeriodSeconds*1000); seconds values rendered 'Unlocked' instantly.
@netlify

netlify Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for spiffy-melomakarona-eb1e8a failed.

Name Link
🔨 Latest commit d166ed8
🔍 Latest deploy log https://app.netlify.com/projects/spiffy-melomakarona-eb1e8a/deploys/6ab60074d7716b0008c86494

@netlify

netlify Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for smart-drop failed.

Name Link
🔨 Latest commit d166ed8
🔍 Latest deploy log https://app.netlify.com/projects/smart-drop/deploys/6ab600745d286400089735dc

@drips-wave

drips-wave Bot commented Sep 25, 2026

Copy link
Copy Markdown

@SweetBoy-eth Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@ritaifeoluwa
ritaifeoluwa merged commit e6cd18f into SmartDropLabs:main Sep 25, 2026
0 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants